<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:65:"D:\AAA\LOLforum\public/../application/index\view\login\index.html";i:1487905534;}*/ ?>
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title><?php echo $title; ?></title>
<link rel="stylesheet" href="__ICSS__/style.css" />
<link rel="stylesheet" href="__ICSS__/register.css" />
<style>
    #phone{width: 180px;}
    #huoqu{cursor: pointer;}
    #huoqu.hover{text-decoration: underline;}
    #cuowu1,#cuowu2,#cuowu3,#cuowu4,#cuowu5{background: #DC3D42;width: 300px;margin-left: 2px;border-radius: 5px;height: 35px;line-height: 35px;}
    .on{display: block;}
    .off{display: none;}
</style>
</head>
<body>

<div class="register-container zhuce">

	<form action="<?php echo url('login/zhuce'); ?>" method="post" id="registerForm">
		<div>
			<input type="text" name="phone" id="phone" placeholder="您的手机号"/>
            <a id="huoqu">获取验证码</a>
            <div id="cuowu1" class="off"><b>请输入正确的手机号</b></div>
		</div>
		<div>
			<input type="text" name="code" id="code" placeholder="请输入验证码" />
            <div id="cuowu2" class="off"><b>验证码不能为空</b></div>
		</div>
        <div>
            <input type="text" name="name" id="nicheng" placeholder="请输入你的昵称"/>
            <div id="cuowu3" class="off"><b>昵称不能为空</b></div>
        </div>
        <div>
            <input type="password" name="password" id="password" class="password" placeholder="输入密码" oncontextmenu="return false" onpaste="return false" />
            <div id="cuowu4" class="off"><b>密码不能为特殊字符</b></div>
        </div>
		<div>
			<input type="password" name="confirm_password" id="repassword" class="confirm_password" placeholder="再次输入密码" oncontextmenu="return false" onpaste="return false" />
            <div id="cuowu5" class="off"><b>两次密码不一致</b></div>

        </div>

        <button id="submit" type="submit" >注 册</button>
    </form>
    <a href="<?php echo url('index/index'); ?>">
        <button type="button" class="register-tis">已经有账号？</button>
    </a>

</div>


<script src="__JS__/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
    var huoqu = document.getElementById('huoqu');
    var phone = document.getElementById('phone');
    var cuowu1 = document.getElementById('cuowu1');
    var code = document.getElementById('code');
    var cuowu2 = document.getElementById('cuowu2');
    var nicheng = document.getElementById('nicheng');
    var cuowu3 = document.getElementById('cuowu3');
    var password = document.getElementById('password');
    var cuowu4 = document.getElementById('cuowu4');
    var repassword = document.getElementById('repassword');
    var cuowu5 = document.getElementById('cuowu5');
    var submit = document.getElementById('submit');
    var registerForm = document.getElementById('registerForm');
    
    // 手机号验证
    phone.onblur = function(){
        if (/^[1][34578][0-9]{9}$/.test(phone.value)) {
            cuowu1.className = 'off';
        }else{
            cuowu1.innerHTML = "请输入正确的手机号";
            cuowu1.className = 'on';
        }
    }
    // 验证码请求
    huoqu.onclick = function (){
        if (/^[1][34578][0-9]{9}$/.test(phone.value)) {
            cuowu1.className = 'off';

            $(function(){
                $.ajax({
                    type:'post',
                    url:"<?php echo url('login/yanzheng'); ?>",
                    data:"phone="+phone.value,
                    success:function(data){
                        if (data) {
                            alert("发送成功");
                        }else{
                            cuowu1.innerHTML = "该手机已经注册";
                            cuowu1.className = 'on';
                        }
                    }
                })
            }) 
        }else{
            cuowu1.innerHTML = "请输入正确的手机号";
            cuowu1.className = 'on';
        }
    }
    // 验证码验证
    code.onblur = function(){
        if (code.value != "") {
            cuowu2.className = 'off';
            $(function(){
                $.ajax({
                    type:'post',
                    url:"<?php echo url('login/yzm'); ?>",
                    data:"phone="+phone.value+"&code="+code.value,
                    success:function(data){
                        if (data == 0) {
                            cuowu2.innerHTML = "请先点击发送验证码";
                            cuowu2.className = 'on';
                        }else if (data == 1) {
                            cuowu2.innerHTML = "验证码已过时";
                            cuowu2.className = 'on';
                        }else if (data == 2) {
                            cuowu2.className = 'off';
                        }else if (data == 3) {
                            cuowu2.innerHTML = "验证码错误";
                            cuowu2.className = 'on';
                        }
                    }
                })
            })
        }else{
            cuowu2.innerHTML = "验证码不能为空";
            cuowu2.className = 'on';
        }
    }
    // 昵称验证
    nicheng.onblur = function(){
        if (nicheng.value != "") {
            cuowu3.className = 'off';
        }else{
            cuowu3.className = 'on';
        }
    }
    // 密码验证
    password.onblur = function(){
        if (password.value.length >= 6 && password.value.length <= 18) {
            if (/^\w{6,18}$/.test(password.value)) {
                cuowu4.className = 'off';
            }else{
                cuowu4.className = 'on'; 
            }
        }else{
            cuowu4.innerHTML = '密码不能低于6位,且不可高于18位';
            cuowu4.className = 'on'; 
        }
    }
    // 两次密码验证
    repassword.onblur = function(){
        cuowu5.innerHTML = '两次密码不一致';
        if (password.value === repassword.value) {
            cuowu5.className = 'off';
        }else{
            cuowu5.className = 'on';
        }
    }

    // 注册
    submit.onclick = function(){
        if (/^[1][34578][0-9]{9}$/.test(phone.value)) {
            cuowu1.className = 'off';
        }else{
            cuowu1.className = 'on';
        }
        if (code.value != "") {
            cuowu2.className = 'off';
        }else{
            cuowu2.className = 'on';
        }
        if (nicheng.value != "") {
            cuowu3.className = 'off';
        }else{
            cuowu3.className = 'on';
        }
        if (password.value.length >= 6 && password.value.length <= 18) {
                cuowu4.className = 'off';
        }else{
            cuowu4.innerHTML = '密码不能低于6位,且不可高于18位';
            cuowu4.className = 'on'; 
        }
        if (password.value === repassword.value) {
            if (repassword.value == "") {
                cuowu5.innerHTML = "请再次输入密码";
                cuowu5.className = 'on';
            }else{
                cuowu5.className = 'off';
            }   
        }else{
            cuowu5.className = 'on';
        }
        if (cuowu1.className == 'off' && cuowu2.className == 'off' && cuowu3.className == 'off' && cuowu4.className == 'off' && cuowu5.className == 'off') {
            
            return true;
        }else{
            registerForm.onsubmit = function(){
                return false;
            }
        }
    }
</script>
<script src="__IJS__/jquery.min.js"></script>

<!-- <script src="__IJS__/common.js"></script> -->
<!--背景图片自动更换-->
<script src="__IJS__/supersized.3.2.7.min.js"></script>
<!--<script src="__IJS__/supersized-init.js"></script>-->
<script>
    jQuery(function($){

    $.supersized({
 //alert('aaaa')
        // 功能
        slide_interval     : 4000,    // 转换之间的长度
        transition         : 1,    // 0 - 无，1 - 淡入淡出，2 - 滑动顶，3 - 滑动向右，4 - 滑底，5 - 滑块向左，6 - 旋转木马右键，7 - 左旋转木马
        transition_speed   : 1000,    // 转型速度
        performance        : 1,    // 0 - 正常，1 - 混合速度/质量，2 - 更优的图像质量，三优的转换速度//（仅适用于火狐/ IE浏览器，而不是Webkit的）

        // 大小和位置
        min_width          : 0,    // 最小允许宽度（以像素为单位）
        min_height         : 0,    // 最小允许高度（以像素为单位）
        vertical_center    : 1,    // 垂直居中背景
        horizontal_center  : 1,    // 水平中心的背景
        fit_always         : 0,    // 图像绝不会超过浏览器的宽度或高度（忽略分钟。尺寸）
        fit_portrait       : 1,    // 纵向图像将不超过浏览器高度
        fit_landscape      : 0,    // 景观的图像将不超过宽度的浏览器

        // 组件
        slide_links        : 'blank',    // 个别环节为每张幻灯片（选项：假的，'民'，'名'，'空'）
        slides             : [    // 幻灯片影像
                                 {image : '__IIMG__/20.jpg'},
                                 {image : '__IIMG__/15.jpg'},
                                 {image : '__IIMG__/21.jpg'},
                                 {image : '__IIMG__/19.jpg'}
                       ]

    });

});

</script>
</body>
</html>